#pragma once

// 布置一些任务函数
#include <iostream>
#include <functional>
#include<unordered_map>

using func_t = std::function<void()>;

void NetRequts()
{
    std::cout << "this is NetRequts..." << std::endl;
}

void MySqlRequts()
{
    std::cout << "this is MySqlRequts..." << std::endl;
}

void RedisRequts()
{
    std::cout << "this is RedisRequts..." << std::endl;
}

class Task
{
public:
    Task()
    {
        tasks_[1] = NetRequts;
        tasks_[2] = MySqlRequts;
        tasks_[3] = RedisRequts;
    }
    func_t operator[](int command)
    {
        if (command < 1 || command > 3)
        {
            return nullptr;
        }
        return tasks_[command];
    }
private:
    std::unordered_map<int, func_t> tasks_;
};